﻿@using PagedList.Mvc
@model Tippelde.Web.Models.Event.EventListModel
@{
    ViewBag.Title = "Események";
}
<div class="row">
    <div class="col-md-3">
        <h3>Csoportok</h3>
        <ul class="nav nav-pills nav-stacked">
            <li class='@(ViewBag.SelectedGroupId==null ? "active" : "")'>@Html.ActionLink("Minden esemény", "Index", "Event")</li>
            @foreach (var g in Model.Groups)
            {
                <li class='@(ViewBag.SelectedGroupId==g.Id ? "active" : "")'>@Html.ActionLink(g.Name, "Group", "Event", new { Id = g.Id }, null)</li>
            }
        </ul>
    </div>
    <div class="col-md-9">
        <h2>Események</h2>
        @if (Model.HasAnyEditorRights)
        {
            <p>
                <a href='@Url.Action("Create", "Event")' class="btn btn-link">
                    <span class="glyphicon glyphicon-plus-sign"></span> Új Esemény hozzáadása
                </a>
            </p>
        }
        <table class="table table-hover table-striped">
            <tbody>
                @foreach (var e in Model.Events)
                {
                    Html.RenderPartial("_EventRow", e);
                }
            </tbody>

        </table>
        <div class="pull-right">
            @Html.PagedListPager(Model.Events, page => Url.Action(ViewBag.SelectedGroupId != null ? "Group" : "Index", "Event", new { Id = ViewBag.SelectedGroupId, pageNumber = page }),
    PagedListRenderOptions.OnlyShowFivePagesAtATime)
        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/tippelde-eventlist")
}